package com.ruoyi.web.controller.epm;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.EpmBlacklist;
import com.ruoyi.system.service.IEpmBlacklistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/Empment/blacklist")
public class EpmBlacklistController extends BaseController {
    @Autowired
    private IEpmBlacklistService iEpmBlacklistService;

    /**
     * 查询黑名单列表
     */
    @PreAuthorize("@ss.hasPermi('Empment:blacklist:list')")
    @GetMapping("/list")
    public TableDataInfo list(EpmBlacklist epmBlacklist) {
        startPage();
        List<EpmBlacklist> list = iEpmBlacklistService.list(epmBlacklist);
        return getDataTable(list);
    }


    /**
     * 新增黑名单数据
     */
    @PreAuthorize("@ss.hasPermi('Empment:blacklist:insert')")
    @PostMapping("/insert")
    public AjaxResult insert(@RequestBody EpmBlacklist epmBlacklist){
        iEpmBlacklistService.insert(epmBlacklist);
        return AjaxResult.success();
    }

    /**
     * 移除黑名单数据
     */
    @PreAuthorize("@ss.hasPermi('Empment:blacklist:delete')")
    @DeleteMapping("/delete/{blackListId}")
    public AjaxResult delete(@PathVariable Integer blackListId) {
        iEpmBlacklistService.delete(blackListId);
        return AjaxResult.success();
    }

    /**
     * 修改表格信息
     */
    @PreAuthorize("@ss.hasPermi('Empment:blacklist:upadte')")
    @PutMapping("/update")
    public AjaxResult update(@RequestBody EpmBlacklist epmBlacklist) {
        iEpmBlacklistService.update(epmBlacklist);
        return AjaxResult.success();
    }

}

